package com.common.general;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseResult<T> {

    private Integer code;
    private String msg;
    private T data;

    public ResponseResult(T data) {
        this.data = data;
    }

    public static <T> ResponseResult success(Integer code, String msg, T data) {
        return new ResponseResult(code, msg, data);
    }

    public static <T> ResponseResult error(Integer code, String msg) {
        return new ResponseResult(code, msg, null);
    }
}
